using System;
using System.IO;

namespace CLELCore
{
	public class CLELLogger : IDisposable
	{
		public const String DEFAULT_LOG_PATH = "logs/clel.log";

		private String _path;
		private StreamWriter _log;

		public String Path
		{
			get
			{
				return _path;
			}
		}
		public CLELLogger()
		{
			_path = DEFAULT_LOG_PATH;
			_log = File.AppendText(_path);
		}

		public CLELLogger(String log_path)
		{
			_path = log_path;
			_log = File.AppendText(_path);
		}

		public void WriteLine(String log_value)
		{
			_log.WriteLine(log_value);
			_log.Flush();
		}
		
		//make sure that FileStream was disposed
		public void Dispose()
		{
			_log.Flush();
			_log.Dispose();
		}
	}
}
